/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package image.utils;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author tommy
 */
public class ImageFileFilter extends FileFilter {
	public boolean accept(File f) {
		if (f.isDirectory()) {
			return true;
		}

		String extension = ImageExtensionUtils.getExtension(f);
		if (extension != null) {
			if (extension.equals(ImageExtensionUtils.tiff) ||
				extension.equals(ImageExtensionUtils.tif) ||
				extension.equals(ImageExtensionUtils.gif) ||
				extension.equals(ImageExtensionUtils.jpeg) ||
				extension.equals(ImageExtensionUtils.jpg) ||
				extension.equals(ImageExtensionUtils.png) ||
				extension.equals(ImageExtensionUtils.raw) ||
				extension.equals(ImageExtensionUtils.bmp) ||
				extension.equals(ImageExtensionUtils.pgm)) {
				return true;
			} else {
				return false;
			}
		}
		return false;
	}

	@Override
	public String getDescription() {
		return "Images";
	}
}
